
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>使用seata分布式事务 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="rocketmq.html" />
    
    
    <link rel="prev" href="../publish/companyserver.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../techstack/">
            
                <a href="../techstack/">
            
                    
                    技术栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    快速开始
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../helloworld/SYSTEM.html">
            
                <a href="../helloworld/SYSTEM.html">
            
                    
                    建立一个系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../helloworld/CORE.html">
            
                <a href="../helloworld/CORE.html">
            
                    
                    选定后台体系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html">
            
                    
                    创建一个实体
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html#实体的定义">
            
                    
                    实体的定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html#发布Entity">
            
                    
                    发布Entity
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.2.1" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html#Service接口">
            
                    
                    Service接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.2" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html#SQL数据库存储模式">
            
                    
                    SQL数据库存储模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.3" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html#MongoDB存储模式">
            
                    
                    MongoDB存储模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.4" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html#ServiceAPI存储模式">
            
                    
                    ServiceAPI存储模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.5" data-path="../helloworld/ENTITY.html">
            
                <a href="../helloworld/ENTITY.html#筛选器">
            
                    
                    筛选器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../helloworld/API.html">
            
                <a href="../helloworld/API.html">
            
                    
                    发布一个服务接口
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.1" data-path="../helloworld/API.html">
            
                <a href="../helloworld/API.html#服务接口的定义">
            
                    
                    服务接口的定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2" data-path="../helloworld/API.html">
            
                <a href="../helloworld/API.html#发布Microserice">
            
                    
                    发布Microserice
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.2.1" data-path="../helloworld/API.html">
            
                <a href="../helloworld/API.html#REST接口">
            
                    
                    REST接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.2" data-path="../helloworld/API.html">
            
                <a href="../helloworld/API.html#DTO参数">
            
                    
                    DTO参数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../helloworld/APP.html">
            
                <a href="../helloworld/APP.html">
            
                    
                    创建一个应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.5.1" data-path="../helloworld/APP.html">
            
                <a href="../helloworld/APP.html#应用的定义">
            
                    
                    应用的定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.2" data-path="../helloworld/APP.html">
            
                <a href="../helloworld/APP.html#应用的发布">
            
                    
                    应用的发布
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.5.2.1" data-path="../helloworld/APP.html">
            
                <a href="../helloworld/APP.html#前端代码">
            
                    
                    JS前端代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.2.2" data-path="../helloworld/APP.html">
            
                <a href="../helloworld/APP.html#Gateway">
            
                    
                    Gateway
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    开发环境设置
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../dev/IDE.html">
            
                <a href="../dev/IDE.html">
            
                    
                    配置开发环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../dev/ENV.html">
            
                <a href="../dev/ENV.html">
            
                    
                    开发环境使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../dev/CFG.html">
            
                <a href="../dev/CFG.html">
            
                    
                    管理配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../dev/ARG.html">
            
                <a href="../dev/ARG.html">
            
                    
                    常规应用参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../dev/PORT.html">
            
                <a href="../dev/PORT.html">
            
                    
                    通用端口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../dev/FB.html">
            
                <a href="../dev/FB.html">
            
                    
                    前后端分离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../dev/DOCKER.html">
            
                <a href="../dev/DOCKER.html">
            
                    
                    Docker和Docker Compose
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    微服务
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../msa/">
            
                <a href="../msa/">
            
                    
                    概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../msa/GW.html">
            
                <a href="../msa/GW.html">
            
                    
                    Gateway
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../msa/BUS.html">
            
                <a href="../msa/BUS.html">
            
                    
                    服务治理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../msa/OU.html">
            
                <a href="../msa/OU.html">
            
                    
                    运行时-ibzou用户管理微服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../msa/WF.html">
            
                <a href="../msa/WF.html">
            
                    
                    运行时-ibzwf工作流微服务
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    选项
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="security.html">
            
                <a href="security.html">
            
                    
                    安全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="es.html">
            
                <a href="es.html">
            
                    
                    Elasticsearch查询性能提升
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="cache.html">
            
                <a href="cache.html">
            
                    
                    使用Redis的两级缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../publish/companyserver.html">
            
                <a href="../publish/companyserver.html">
            
                    
                    使用Logback
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../publish/companyserver.html">
            
                <a href="../publish/companyserver.html">
            
                    
                    使用Druid
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="dynamicDS.html">
            
                <a href="dynamicDS.html">
            
                    
                    dynamic datasource多数据源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../publish/companyserver.html">
            
                <a href="../publish/companyserver.html">
            
                    
                    使用xxl-job任务调度
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.8" data-path="transactional.html">
            
                <a href="transactional.html">
            
                    
                    使用seata分布式事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="rocketmq.html">
            
                <a href="rocketmq.html">
            
                    
                    使用RocketMQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../other/EX.html">
            
                <a href="../other/EX.html">
            
                    
                    扩展
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../end/">
            
                <a href="../end/">
            
                    
                    结束
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >使用seata分布式事务</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;">&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;</h1>
<p><a href="http://seata.io/zh-cn/docs/overview/what-is-seata.html" target="_blank">Seata</a> &#x662F; <strong>&#x963F;&#x91CC;&#x5DF4;&#x5DF4; </strong>&#x5F00;&#x6E90;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x81F4;&#x529B;&#x4E8E;&#x63D0;&#x4F9B;&#x9AD8;&#x6027;&#x80FD;&#x548C;&#x7B80;&#x5355;&#x6613;&#x7528;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x670D;&#x52A1;&#x3002;Seata&#x4E3A;&#x7528;&#x6237;&#x63D0;&#x4F9B;&#x4E86; AT&#x3001;TCC&#x3001;SAGA &#x548C; XA &#x56DB;&#x79CD;&#x4E8B;&#x52A1;&#x6A21;&#x5F0F;&#xFF0C;&#x4E3A;&#x7528;&#x6237;&#x6253;&#x9020;&#x4E00;&#x7AD9;&#x5F0F;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x3002;&#x5728;Seata&#x6240;&#x652F;&#x6301;&#x7684;&#x56DB;&#x79CD;&#x6A21;&#x5F0F;&#x4E2D;&#xFF0C;&#x76EE;&#x524D;&#x4F7F;&#x7528;&#x7684;&#x6D41;&#x884C;&#x5EA6;&#x60C5;&#x51B5;&#x662F;&#xFF1A;AT &gt; TCC &gt; Saga&#x3002;&#x7EFC;&#x5408;&#x4F7F;&#x7528;&#x6210;&#x672C;&#x3001;&#x4EE3;&#x7801;&#x4FB5;&#x5165;&#x6027;&#x7B49;&#x591A;&#x65B9;&#x9762;&#x56E0;&#x7D20;&#x8003;&#x8651;&#xFF0C;AT&#x6A21;&#x5F0F;&#x65E0;&#x7591;&#x662F;&#x6700;&#x4F18;&#x7684;&#x9009;&#x62E9;&#xFF0C;&#x672C;&#x6587;&#x4E3B;&#x8981;&#x4ECB;&#x7ECD;&#x4E86;ibizlab&#x5BF9;Seata AT&#x6A21;&#x5F0F;&#x7684;&#x9002;&#x914D;&#x3002;</p>
<h3 id="&#x539F;&#x7406;&#x548C;&#x8BBE;&#x8BA1;">&#x539F;&#x7406;&#x548C;&#x8BBE;&#x8BA1;</h3>
<p>&#x5728; Seata &#x7684;&#x67B6;&#x6784;&#x4E2D;&#xFF0C;&#x4E00;&#x5171;&#x6709;&#x4E09;&#x4E2A;&#x89D2;&#x8272;&#xFF1A;</p>
<ul>
<li><p><strong>TC&#xFF1A;</strong>(Transaction Coordinator) - &#x4E8B;&#x52A1;&#x534F;&#x8C03;&#x8005;&#xFF1A;&#x7EF4;&#x62A4;&#x5168;&#x5C40;&#x548C;&#x5206;&#x652F;&#x4E8B;&#x52A1;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x9A71;&#x52A8; <strong>&#x5168;&#x5C40;&#x4E8B;&#x52A1; </strong>&#x63D0;&#x4EA4;&#x6216;&#x56DE;&#x6EDA;&#x3002;</p>
</li>
<li><p><strong>TM&#xFF1A;</strong>(Transaction Manager) - &#x4E8B;&#x52A1;&#x7BA1;&#x7406;&#x5668;&#xFF1A;&#x5B9A;&#x4E49; <strong>&#x5168;&#x5C40;&#x4E8B;&#x52A1; </strong>&#x7684;&#x8303;&#x56F4;&#xFF0C;&#x5F00;&#x59CB;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x3001;&#x63D0;&#x4EA4;&#x6216;&#x56DE;&#x6EDA;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x3002;</p>
</li>
<li><p><strong>RM</strong>&#xFF1A;( Resource Manager ) - &#x8D44;&#x6E90;&#x7BA1;&#x7406;&#x5668;&#xFF1A;&#x7BA1;&#x7406; <strong>&#x5206;&#x652F;&#x4E8B;&#x52A1; </strong>&#x5904;&#x7406;&#x7684;&#x8D44;&#x6E90;( Resource )&#xFF0C;&#x4E0E; TC &#x4EA4;&#x8C08;&#x4EE5;&#x6CE8;&#x518C;&#x5206;&#x652F;&#x4E8B;&#x52A1;&#x548C;&#x62A5;&#x544A;&#x5206;&#x652F;&#x4E8B;&#x52A1;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x5E76;&#x9A71;&#x52A8; <strong>&#x5206;&#x652F;&#x4E8B;&#x52A1; </strong>&#x63D0;&#x4EA4;&#x6216;&#x56DE;&#x6EDA;&#x3002;</p>
</li>
</ul>
<p>&#x5176;&#x4E2D;&#xFF0C;TC &#x4E3A;&#x5355;&#x72EC;&#x90E8;&#x7F72;&#x7684; <strong>Server </strong>&#x670D;&#x52A1;&#x7AEF;&#xFF0C;TM &#x548C; RM &#x4E3A;&#x5D4C;&#x5165;&#x5230;&#x5E94;&#x7528;&#x4E2D;&#x7684; <strong>Client </strong>&#x5BA2;&#x6237;&#x7AEF;&#x3002;</p>
<p>&#x5728; Seata &#x4E2D;&#xFF0C;&#x4E00;&#x4E2A;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x7684; <strong>&#x751F;&#x547D;&#x5468;&#x671F; </strong>&#x5982;&#x4E0B;&#xFF1A;</p>
<p><img src="../img/transactional1.png" alt="img">TM &#x8BF7;&#x6C42; TC &#x5F00;&#x542F;&#x4E00;&#x4E2A;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x3002;TC &#x4F1A;&#x751F;&#x6210;&#x4E00;&#x4E2A; <strong>XID </strong>&#x4F5C;&#x4E3A;&#x8BE5;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x7684;&#x7F16;&#x53F7;&#x3002;</p>
<ul>
<li><blockquote>
<p><strong>XID</strong>&#xFF0C;&#x4F1A;&#x5728;&#x5FAE;&#x670D;&#x52A1;&#x7684;&#x8C03;&#x7528;&#x94FE;&#x8DEF;&#x4E2D;&#x4F20;&#x64AD;&#xFF0C;&#x4FDD;&#x8BC1;&#x5C06;&#x591A;&#x4E2A;&#x5FAE;&#x670D;&#x52A1;&#x7684;&#x5B50;&#x4E8B;&#x52A1;&#x5173;&#x8054;&#x5728;&#x4E00;&#x8D77;&#x3002;</p>
</blockquote>
</li>
<li><p>RM &#x8BF7;&#x6C42; TC &#x5C06;&#x672C;&#x5730;&#x4E8B;&#x52A1;&#x6CE8;&#x518C;&#x4E3A;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x7684;&#x5206;&#x652F;&#x4E8B;&#x52A1;&#xFF0C;&#x901A;&#x8FC7;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x7684;<strong>XID</strong>&#x8FDB;&#x884C;&#x5173;&#x8054;&#x3002;</p>
</li>
<li><p>TM &#x8BF7;&#x6C42; TC &#x544A;&#x8BC9; <strong>XID </strong>&#x5BF9;&#x5E94;&#x7684;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x662F;&#x8FDB;&#x884C;&#x63D0;&#x4EA4;&#x8FD8;&#x662F;&#x56DE;&#x6EDA;&#x3002;</p>
</li>
<li><p>TC &#x9A71;&#x52A8; RM &#x4EEC;&#x5C06; <strong>XID </strong>&#x5BF9;&#x5E94;&#x7684;&#x81EA;&#x5DF1;&#x7684;&#x672C;&#x5730;&#x4E8B;&#x52A1;&#x8FDB;&#x884C;&#x63D0;&#x4EA4;&#x8FD8;&#x662F;&#x56DE;&#x6EDA;&#x3002;</p>
</li>
</ul>
<h3 id="at&#x6A21;&#x5F0F;">AT&#x6A21;&#x5F0F;</h3>
<p><a href="#">AT &#x6A21;&#x5F0F;</a> &#x662F;&#x4E00;&#x79CD;&#x65E0;&#x4FB5;&#x5165;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;AT&#x6A21;&#x5F0F;&#x5373;&#x89E3;&#x51B3;&#x4E86;XA&#x6A21;&#x5F0F;&#x6240;&#x5E26;&#x6765;&#x7684;&#x6027;&#x80FD;&#x95EE;&#x9898;&#xFF0C;&#x53C8;&#x89E3;&#x51B3;&#x4E86;TCC&#x6A21;&#x5F0F;&#x6240;&#x5E26;&#x6765;&#x7684;&#x4E1A;&#x52A1;&#x4FB5;&#x5165;&#x6027;&#x95EE;&#x9898;&#x3002;&#x5728; AT &#x6A21;&#x5F0F;&#x4E0B;&#xFF0C;&#x7528;&#x6237;&#x53EA;&#x9700;&#x5173;&#x6CE8;&#x81EA;&#x5DF1;&#x7684;&#x201C;&#x4E1A;&#x52A1; SQL&#x201D;&#xFF0C;&#x7528;&#x6237;&#x7684; &#x201C;&#x4E1A;&#x52A1; SQL&#x201D; &#x4F5C;&#x4E3A;&#x4E00;&#x9636;&#x6BB5;&#xFF0C;Seata &#x6846;&#x67B6;&#x4F1A;&#x81EA;&#x52A8;&#x751F;&#x6210;&#x4E8B;&#x52A1;&#x7684;&#x4E8C;&#x9636;&#x6BB5;&#x63D0;&#x4EA4;&#x548C;&#x56DE;&#x6EDA;&#x64CD;&#x4F5C;&#x3002;</p>
<ul>
<li><p>&#x4E00;&#x9636;&#x6BB5;&#xFF1A;&#x4E1A;&#x52A1;&#x6570;&#x636E;&#x548C;&#x56DE;&#x6EDA;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x672C;&#x5730;&#x4E8B;&#x52A1;&#x4E2D;&#x63D0;&#x4EA4;&#xFF0C;&#x91CA;&#x653E;&#x672C;&#x5730;&#x9501;&#x548C;&#x8FDE;&#x63A5;&#x8D44;&#x6E90;&#x3002;</p>
</li>
<li><p>&#x4E8C;&#x9636;&#x6BB5;&#xFF1A;</p>
<ul>
<li>&#x63D0;&#x4EA4;&#x5F02;&#x6B65;&#x5316;&#xFF0C;&#x975E;&#x5E38;&#x5FEB;&#x901F;&#x5730;&#x5B8C;&#x6210;&#x3002;</li>
<li>&#x56DE;&#x6EDA;&#x901A;&#x8FC7;&#x4E00;&#x9636;&#x6BB5;&#x7684;&#x56DE;&#x6EDA;&#x65E5;&#x5FD7;&#x8FDB;&#x884C;&#x53CD;&#x5411;&#x8865;&#x507F;&#x3002;</li>
</ul>
</li>
</ul>
<p><img src="../img/transactional6.png" alt="img"></p>
<h3 id="&#x5F00;&#x542F;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;">&#x5F00;&#x542F;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;</h3>
<ul>
<li>&#x5728;&#x7CFB;&#x7EDF;&#x6240;&#x5C5E;&#x7684;&#x5FAE;&#x670D;&#x52A1;&#x5E73;&#x53F0;&#x4E2D;&#x8BBE;&#x7F6E;&#x53C2;&#x6570; <strong>seata.enabled=true</strong> &#x6765;&#x7CFB;&#x7EDF;&#x5F00;&#x542F;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x3002;</li>
</ul>
<p><img src="../img/transactional7.png" alt="img"></p>
<ul>
<li>&#x5C06;&#x5B9E;&#x4F53;&#x884C;&#x4E3A;&#x6DFB;&#x52A0;&#x6807;&#x8BB0; <strong>GlobalTransactional</strong> ,&#x8BE5;&#x884C;&#x4E3A;&#x4E2D;&#x7684;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x5C06;&#x53D7;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x7BA1;&#x63A7;&#x3002;</li>
</ul>
<p><img src="../img/transactional8.png" alt="img"></p>
<ul>
<li>&#x4F7F;&#x7528;AT&#x6A21;&#x5F0F;&#x7684;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#xFF0C;&#x5728;&#x4F7F;&#x7528;&#x65F6;&#x53EA;&#x9700;&#x8981;&#x58F0;&#x660E; <strong>GlobalTransactional</strong> &#x6CE8;&#x89E3;&#xFF0C;&#x63D0;&#x4EA4;&#x53CA;&#x56DE;&#x6EDA;&#x903B;&#x8F91;&#x7531;Seata &#x6765;&#x63A5;&#x7BA1;&#xFF0C;&#x4F7F;&#x7528;&#x8D77;&#x6765;&#x4E0E;&#x672C;&#x5730;&#x4E8B;&#x52A1;&#x7684;&#x6A21;&#x5F0F;&#x4E00;&#x6837;&#x3002;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Slf</span>4j
<span class="hljs-meta">@Primary</span>
<span class="hljs-meta">@Service</span>(<span class="hljs-string">&quot;HumanExService&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">HumanExService</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">HumanServiceImpl</span> </span>{
    <span class="hljs-comment">/**
     * &#x81EA;&#x5B9A;&#x4E49;&#x884C;&#x4E3A;[CUSTOM]&#x7528;&#x6237;&#x6269;&#x5C55;
     * <span class="hljs-doctag">@param</span> et
     * <span class="hljs-doctag">@return</span>
     */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@GlobalTransactional</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> Human <span class="hljs-title">cUSTOM</span><span class="hljs-params">(Human et)</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.cUSTOM(et);
    }
}
</code></pre>
<h3 id="&#x4E8B;&#x52A1;&#x5206;&#x7EC4;&#x4E0E;&#x96C6;&#x7FA4;">&#x4E8B;&#x52A1;&#x5206;&#x7EC4;&#x4E0E;&#x96C6;&#x7FA4;</h3>
<p>TC&#x4F5C;&#x4E3A;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x7684;&#x534F;&#x8C03;&#x8005;&#xFF0C;&#x8D1F;&#x8D23;&#x9A71;&#x52A8; <strong>&#x5168;&#x5C40;&#x4E8B;&#x52A1; </strong>&#x63D0;&#x4EA4;&#x6216;&#x56DE;&#x6EDA;&#xFF0C;&#x5982;&#x679C;TC&#x51FA;&#x73B0;&#x5B95;&#x673A;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x5FAE;&#x670D;&#x52A1;&#x5C06;&#x5904;&#x4E8E;&#x4E0D;&#x53EF;&#x7528;&#x72B6;&#x6001;&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x9020;&#x6210;&#x4E25;&#x91CD;&#x540E;&#x679C;&#x3002;&#x4E8B;&#x52A1;&#x7684;&#x5206;&#x7EC4;&#x53CA;TC&#x7684;&#x96C6;&#x7FA4;&#xFF0C;&#x6B63;&#x662F;&#x4E3A;&#x4E86;&#x5B9E;&#x73B0;TC&#x9AD8;&#x53EF;&#x7528;&#x7684;&#x4E00;&#x79CD;&#x65B9;&#x6848;&#x3002;</p>
<ul>
<li>TC&#x96C6;&#x7FA4;</li>
</ul>
<p>TC&#x96C6;&#x7FA4;&#x65F6;&#xFF0C;&#x591A;&#x4E2A; Seata TC Server &#x901A;&#x8FC7;<strong>db</strong>&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x5B9E;&#x73B0;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x4F1A;&#x8BDD;&#x4FE1;&#x606F;&#x7684;&#x5171;&#x4EAB;&#x3002;</p>
<p>&#x540C;&#x65F6;&#xFF0C;&#x6BCF;&#x4E2A; Seata TC Server &#x53EF;&#x4EE5;&#x6CE8;&#x518C;&#x81EA;&#x5DF1;&#x5230;&#x6CE8;&#x518C;&#x4E2D;&#x5FC3;&#x4E0A;&#xFF0C;&#x65B9;&#x4FBF;&#x5E94;&#x7528;&#x4ECE;&#x6CE8;&#x518C;&#x4E2D;&#x5FC3;&#x83B7;&#x5F97;&#x5230;&#x4ED6;&#x4EEC;&#x3002;&#x6700;&#x7EC8;&#x6211;&#x4EEC;&#x90E8;&#x7F72; &#x96C6;&#x7FA4; TC Server &#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;</p>
<p><img src="../img/transactional2.png" alt="img"></p>
<ul>
<li>&#x4E8B;&#x52A1;&#x5206;&#x7EC4;</li>
</ul>
<p>&#x5728;&#x5FAE;&#x670D;&#x52A1;&#x4E2D;&#xFF0C;&#x53EF;&#x4E3A;&#x6BCF;&#x4E2A;&#x5FAE;&#x670D;&#x52A1;&#x5206;&#x914D;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x7EC4;&#xFF0C;&#x6BCF;&#x4E2A;&#x4E8B;&#x52A1;&#x7EC4;&#x5219;&#x5BF9;&#x5E94;&#x6CE8;&#x518C;&#x4E2D;&#x5FC3;&#xFF08;&#x5982;&#xFF1A;Nacos&#xFF09;&#x7684;&#x4E00;&#x4E2A;TC Server&#x96C6;&#x7FA4;&#xFF0C;&#x901A;&#x8FC7;&#x8BE5;&#x65B9;&#x5F0F;&#x5C06;&#x5FAE;&#x670D;&#x52A1;&#x7684;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x8BF7;&#x6C42;&#x8F6C;&#x53D1;&#x81F3;TC Server&#x96C6;&#x7FA4;&#x4E2D;&#x5BF9;&#x5E94;&#x7684;TC Server&#x8282;&#x70B9;&#x6765;&#x5904;&#x7406;&#x3002;&#x5F53;&#x51FA;&#x73B0;TC Server&#x96C6;&#x7FA4;&#x6545;&#x969C;&#x65F6;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5207;&#x6362;&#x4E8B;&#x52A1;&#x7EC4;&#x7684;&#x65B9;&#x5F0F;&#x66F4;&#x6539;TC Server&#x96C6;&#x7FA4;&#xFF0C;&#x4F7F;&#x7CFB;&#x7EDF;&#x80FD;&#x5FEB;&#x901F;&#x6062;&#x590D;&#x6B63;&#x5E38;&#x3002;</p>
<p>&#x5FAE;&#x670D;&#x52A1;&#x4E2D;&#x5206;&#x914D;&#x4E8B;&#x52A1;&#x7EC4;&#x53CA;&#x4E3A;&#x4E8B;&#x52A1;&#x7EC4;&#x6307;&#x5B9A;&#x5BF9;&#x5E94;nacos&#x4E2D;&#x7684;Tc Server&#x96C6;&#x7FA4;&#x4E3A;default&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;</p>
<p><img src="../img/transactional3.png" alt="img"></p>
<p>Nacos&#x4E2D;&#x7684;Tc Server default &#x96C6;&#x7FA4;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;</p>
<p><img src="../img/transactional4.png" alt="img"></p>
<p>&#x5728;&#x90E8;&#x7F72;Tc Server&#x8282;&#x70B9;&#x65F6;&#xFF0C;&#x5C06;&#x8282;&#x70B9;&#x6CE8;&#x518C;&#x5230;Nacos default&#x7684;&#x96C6;&#x7FA4;&#x4E2D;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;</p>
<h3 id="&#x5165;&#x95E8;&#x793A;&#x4F8B;"><img src="../img/transactional5.png" alt="img">&#x5165;&#x95E8;&#x793A;&#x4F8B;</h3>
<p><a href="http://www.iocoder.cn/Spring-Cloud-Alibaba/Seata/?self" target="_blank">http://www.iocoder.cn/Spring-Cloud-Alibaba/Seata/?self</a></p>
<h3 id="&#x4F7F;&#x7528;&#x987B;&#x77E5;">&#x4F7F;&#x7528;&#x987B;&#x77E5;</h3>
<p>&#x7531;&#x4E8E; Seata &#x5F00;&#x542F;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x65F6;&#x9700;&#x8981;&#x8BB0;&#x5F55;&#x6570;&#x636E;&#x7684;&#x524D;&#x540E;&#x955C;&#x50CF;&#xFF0C;&#x4EE5;&#x5B9E;&#x73B0;&#x5728;&#x51FA;&#x73B0;&#x5F02;&#x5E38;&#x65F6;&#x901A;&#x8FC7;&#x955C;&#x50CF;&#x8FDB;&#x884C;&#x56DE;&#x6EDA;&#x3002;&#x5728;&#x66F4;&#x65B0;&#x65F6;&#xFF0C;Seata&#x4F1A;&#x6839;&#x636E;&#x5F53;&#x524D;&#x66F4;&#x65B0;&#x7684;&#x5217;&#x5230;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x83B7;&#x53D6;&#x5BF9;&#x5E94;&#x7684;&#x5217;&#x4FE1;&#x606F;&#xFF08;&#x5982;&#x5217;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x3001;&#x5F53;&#x524D;&#x503C;&#x7B49;&#xFF09;&#x5E76;&#x8BB0;&#x5F55;&#x5230;Log &#x4E2D;&#x3002;&#x7531;&#x4E8E;Mybatis&#x5728;&#x8FDB;&#x884C;&#x66F4;&#x65B0;&#x64CD;&#x4F5C;&#x65F6;&#xFF0C;&#x6240;&#x8F93;&#x51FA;&#x66F4;&#x65B0;SQL&#x4E2D;&#x7684;&#x5217;&#x4E3A;&#x5C0F;&#x5199;&#xFF0C;&#x4F46;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x7684;&#x5217;&#x4E3A;&#x5927;&#x5199;&#xFF0C;Seata &#x65E0;&#x6CD5;&#x901A;&#x8FC7;&#x66F4;&#x65B0;SQL&#x4E2D;&#x7684;&#x5217;&#x5339;&#x914D;&#x5230;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x5BF9;&#x5E94;&#x7684;&#x5217;&#xFF08;&#x5927;&#x5C0F;&#x5199;&#x4E0D;&#x4E00;&#x81F4;&#xFF09;&#xFF0C;&#x7EE7;&#x800C;&#x5F15;&#x53D1;&#x7A7A;&#x6307;&#x9488;&#x9519;&#x8BEF;&#x3002;</p>
<p><img src="../img/transactional9.jpg" alt="img"></p>
<p>&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#xFF1A;&#x91CD;&#x5199;Seata&#x7684; TableRecords &#x7C7B;&#xFF0C;&#x5148;&#x6309;&#x66F4;&#x65B0;SQL&#x4E2D;&#x7684;&#x5217;&#x6765;&#x83B7;&#x53D6;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x7684;&#x5217;&#x4FE1;&#x606F;&#xFF0C;&#x82E5;&#x83B7;&#x53D6;&#x4E0D;&#x5230;&#x65F6;&#xFF0C;&#x518D;&#x901A;&#x8FC7;&#x5927;&#x5199;&#x5217;&#x540D;&#x5230;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x83B7;&#x53D6;&#x5373;&#x53EF;&#x3002;</p>
<p>&#x7531;&#x4E8E;Core&#x4E2D;&#x5DF2;&#x5F15;&#x4E86;Seata&#x7684;&#x4F9D;&#x8D56;&#x5305;&#xFF0C;&#x6240;&#x4EE5;&#x5EFA;&#x8BAE;&#x5C06;&#x8BE5;&#x7C7B;&#x653E;&#x5728;Core&#x4E2D;&#x3002;&#x82E5;&#x5C06;&#x672C;&#x7C7B;&#x653E;&#x5728;&#x9664;Core&#x4EE5;&#x5916;&#x7684;&#x5176;&#x5B83;&#x9879;&#x76EE;&#x4E2D;&#x65F6;&#xFF0C;&#x9664;&#x4E86;&#x91CD;&#x5199;&#x8BE5;&#x7C7B;&#xFF0C;&#x8FD8;&#x9700;&#x5F15;&#x5165;&#x4F9D;&#x8D56;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-keyword">package</span> io.seata.rm.datasource.sql.struct;

<span class="hljs-keyword">import</span> io.seata.common.exception.ShouldNeverHappenException;
<span class="hljs-keyword">import</span> io.seata.rm.datasource.sql.serial.SerialArray;
<span class="hljs-keyword">import</span> javax.sql.rowset.serial.*;
<span class="hljs-keyword">import</span> java.net.URL;
<span class="hljs-keyword">import</span> java.sql.*;
<span class="hljs-keyword">import</span> java.util.*;

<span class="hljs-comment">/**
 * &#x91CD;&#x5199;&#x89E3;&#x51B3;&#x5168;&#x5C40;&#x4E8B;&#x52A1;&#x5728;&#x6784;&#x9020;&#x6570;&#x636E;&#x524D;&#x955C;&#x50CF;&#x65F6;&#xFF0C;
 * update column&#x4E0E;&#x6570;&#x636E;&#x5E93;&#x5217;&#x5927;&#x5C0F;&#x5199;&#x4E0D;&#x5339;&#x914D;&#x95EE;&#x9898; &#xFF08;&#x4FEE;&#x6539;&#x884C;:107-110&#xFF09;
 */</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TableRecords</span> </span>{
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">transient</span> TableMeta tableMeta;
    <span class="hljs-keyword">private</span> String tableName;
    <span class="hljs-keyword">private</span> List&lt;Row&gt; rows = <span class="hljs-keyword">new</span> ArrayList();

    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">getTableName</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.tableName;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setTableName</span><span class="hljs-params">(String tableName)</span> </span>{
        <span class="hljs-keyword">this</span>.tableName = tableName;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> List&lt;Row&gt; <span class="hljs-title">getRows</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.rows;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setRows</span><span class="hljs-params">(List&lt;Row&gt; rows)</span> </span>{
        <span class="hljs-keyword">this</span>.rows = rows;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">TableRecords</span><span class="hljs-params">()</span> </span>{
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">TableRecords</span><span class="hljs-params">(TableMeta tableMeta)</span> </span>{
        <span class="hljs-keyword">this</span>.setTableMeta(tableMeta);
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setTableMeta</span><span class="hljs-params">(TableMeta tableMeta)</span> </span>{
        <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.tableMeta != <span class="hljs-keyword">null</span>) {
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> ShouldNeverHappenException();
        } <span class="hljs-keyword">else</span> {
            <span class="hljs-keyword">this</span>.tableMeta = tableMeta;
            <span class="hljs-keyword">this</span>.tableName = tableMeta.getTableName();
        }
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">size</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.rows.size();
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">add</span><span class="hljs-params">(Row row)</span> </span>{
        <span class="hljs-keyword">this</span>.rows.add(row);
    }

    <span class="hljs-keyword">public</span> List&lt;Map&lt;String, Field&gt;&gt; pkRows() {
        Map&lt;String, ColumnMeta&gt; primaryKeyMap = <span class="hljs-keyword">this</span>.getTableMeta().getPrimaryKeyMap();
        List&lt;Map&lt;String, Field&gt;&gt; pkRows = <span class="hljs-keyword">new</span> ArrayList();
        Iterator var3 = <span class="hljs-keyword">this</span>.rows.iterator();

        <span class="hljs-keyword">while</span>(var3.hasNext()) {
            Row row = (Row)var3.next();
            List&lt;Field&gt; fields = row.getFields();
            Map&lt;String, Field&gt; rowMap = <span class="hljs-keyword">new</span> HashMap(<span class="hljs-number">3</span>);
            Iterator var7 = fields.iterator();

            <span class="hljs-keyword">while</span>(var7.hasNext()) {
                Field field = (Field)var7.next();
                <span class="hljs-keyword">if</span> (primaryKeyMap.containsKey(field.getName())) {
                    rowMap.put(field.getName(), field);
                }
            }

            pkRows.add(rowMap);
        }

        <span class="hljs-keyword">return</span> pkRows;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> TableMeta <span class="hljs-title">getTableMeta</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.tableMeta;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> TableRecords <span class="hljs-title">empty</span><span class="hljs-params">(TableMeta tableMeta)</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> EmptyTableRecords(tableMeta);
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> TableRecords <span class="hljs-title">buildRecords</span><span class="hljs-params">(TableMeta tmeta, ResultSet resultSet)</span> <span class="hljs-keyword">throws</span> SQLException </span>{
        TableRecords records = <span class="hljs-keyword">new</span> TableRecords(tmeta);
        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
        <span class="hljs-keyword">int</span> columnCount = resultSetMetaData.getColumnCount();

        <span class="hljs-keyword">while</span>(resultSet.next()) {
            List&lt;Field&gt; fields = <span class="hljs-keyword">new</span> ArrayList(columnCount);

            <span class="hljs-keyword">for</span>(<span class="hljs-keyword">int</span> i = <span class="hljs-number">1</span>; i &lt;= columnCount; ++i) {
                String colName = resultSetMetaData.getColumnName(i);
                ColumnMeta col = tmeta.getColumnMeta(colName);
                <span class="hljs-comment">//&#x91CD;&#x5199;&#x4EE3;&#x7801;&#xFF1A;&#x5148;&#x6309; update &#x7684;column&#x53D6;&#xFF0C;&#x53D6;&#x4E0D;&#x5230;&#x518D;&#x8F6C;&#x5927;&#x5199;&#x83B7;&#x53D6;</span>
                <span class="hljs-keyword">if</span>(col==<span class="hljs-keyword">null</span>){
                    col = tmeta.getColumnMeta(colName.toUpperCase());
                }
                <span class="hljs-comment">//</span>
                <span class="hljs-keyword">int</span> dataType = col.getDataType();
                Field field = <span class="hljs-keyword">new</span> Field();
                field.setName(col.getColumnName());
                <span class="hljs-keyword">if</span> (tmeta.getPrimaryKeyMap().containsKey(colName)) {
                    field.setKeyType(KeyType.PRIMARY_KEY);
                }

                field.setType(dataType);
                <span class="hljs-keyword">if</span> (dataType == JDBCType.BLOB.getVendorTypeNumber()) {
                    Blob blob = resultSet.getBlob(i);
                    <span class="hljs-keyword">if</span> (blob != <span class="hljs-keyword">null</span>) {
                        field.setValue(<span class="hljs-keyword">new</span> SerialBlob(blob));
                    }
                } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (dataType == JDBCType.CLOB.getVendorTypeNumber()) {
                    Clob clob = resultSet.getClob(i);
                    <span class="hljs-keyword">if</span> (clob != <span class="hljs-keyword">null</span>) {
                        field.setValue(<span class="hljs-keyword">new</span> SerialClob(clob));
                    }
                } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (dataType == JDBCType.ARRAY.getVendorTypeNumber()) {
                    Array array = resultSet.getArray(i);
                    <span class="hljs-keyword">if</span> (array != <span class="hljs-keyword">null</span>) {
                        field.setValue(<span class="hljs-keyword">new</span> SerialArray(array));
                    }
                } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (dataType == JDBCType.REF.getVendorTypeNumber()) {
                    Ref ref = resultSet.getRef(i);
                    <span class="hljs-keyword">if</span> (ref != <span class="hljs-keyword">null</span>) {
                        field.setValue(<span class="hljs-keyword">new</span> SerialRef(ref));
                    }
                } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (dataType == JDBCType.DATALINK.getVendorTypeNumber()) {
                    URL url = resultSet.getURL(i);
                    <span class="hljs-keyword">if</span> (url != <span class="hljs-keyword">null</span>) {
                        field.setValue(<span class="hljs-keyword">new</span> SerialDatalink(url));
                    }
                } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (dataType == JDBCType.JAVA_OBJECT.getVendorTypeNumber()) {
                    Object object = resultSet.getObject(i);
                    <span class="hljs-keyword">if</span> (object != <span class="hljs-keyword">null</span>) {
                        field.setValue(<span class="hljs-keyword">new</span> SerialJavaObject(object));
                    }
                } <span class="hljs-keyword">else</span> {
                    field.setValue(resultSet.getObject(i));
                }

                fields.add(field);
            }

            Row row = <span class="hljs-keyword">new</span> Row();
            row.setFields(fields);
            records.add(row);
        }

        <span class="hljs-keyword">return</span> records;
    }

    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">EmptyTableRecords</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">TableRecords</span> </span>{
        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">EmptyTableRecords</span><span class="hljs-params">()</span> </span>{
        }

        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">EmptyTableRecords</span><span class="hljs-params">(TableMeta tableMeta)</span> </span>{
            <span class="hljs-keyword">this</span>.setTableMeta(tableMeta);
        }

        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">size</span><span class="hljs-params">()</span> </span>{
            <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
        }

        <span class="hljs-keyword">public</span> List&lt;Map&lt;String, Field&gt;&gt; pkRows() {
            <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ArrayList();
        }

        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">add</span><span class="hljs-params">(Row row)</span> </span>{
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> UnsupportedOperationException(<span class="hljs-string">&quot;xxx&quot;</span>);
        }

        <span class="hljs-function"><span class="hljs-keyword">public</span> TableMeta <span class="hljs-title">getTableMeta</span><span class="hljs-params">()</span> </span>{
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> UnsupportedOperationException(<span class="hljs-string">&quot;xxx&quot;</span>);
        }
    }
}
</code></pre>
<p>Seata&#x4F9D;&#x8D56;&#x5305;</p>
<pre><code class="lang-java">       &lt;!--  &#x963F;&#x91CC;seata&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1; --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;io.seata&lt;/groupId&gt;
            &lt;artifactId&gt;seata-spring-boot-starter&lt;/artifactId&gt;
            &lt;exclusions&gt;
                &lt;exclusion&gt;
                    &lt;groupId&gt;com.alibaba&lt;/groupId&gt;
                    &lt;artifactId&gt;druid&lt;/artifactId&gt;
                &lt;/exclusion&gt;
            &lt;/exclusions&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;com.alibaba.cloud&lt;/groupId&gt;
            &lt;artifactId&gt;spring-cloud-starter-alibaba-seata&lt;/artifactId&gt;
            &lt;exclusions&gt;
                &lt;exclusion&gt;
                    &lt;groupId&gt;io.seata&lt;/groupId&gt;
                    &lt;artifactId&gt;seata-spring-boot-starter&lt;/artifactId&gt;
                &lt;/exclusion&gt;
            &lt;/exclusions&gt;
        &lt;/dependency&gt;
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../publish/companyserver.html" class="navigation navigation-prev " aria-label="Previous page: 使用xxl-job任务调度">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="rocketmq.html" class="navigation navigation-next " aria-label="Next page: 使用RocketMQ">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"使用seata分布式事务","level":"1.6.8","depth":2,"next":{"title":"使用RocketMQ","level":"1.6.9","depth":2,"path":"option/rocketmq.md","ref":"option/rocketmq.md","articles":[]},"previous":{"title":"使用xxl-job任务调度","level":"1.6.7","depth":2,"path":"publish/companyserver.md","ref":"publish/companyserver.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"option/transactional.md","mtime":"2020-08-20T13:18:25.132Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-10-08T05:59:13.818Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

